package com.xc.hotelmgr.webapi.modules.op.controller;


import com.xc.hotelmgr.webapi.common.utils.R;
import com.xc.hotelmgr.webapi.modules.op.service.DateServeice;
import com.xc.hotelmgr.webapi.modules.sys.controller.AbstractController;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@RestController
@RequestMapping("op/date")
public class DateController extends AbstractController {

    @Autowired
    private DateServeice dateServeice;

    /**
     * redis存入日期列表
     * @param params
     * @return
     */
    @RequiresPermissions("op:date:set")
    @RequestMapping(value = "/set", method = RequestMethod.POST)
    public R set(@RequestBody Map<String, Object> params) {
        dateServeice.set(params);
        return R.ok();
    }

    /**
     * 删除设定的日期
     * @param params
     * @return
     */
    @RequiresPermissions("op:date:del")
    @RequestMapping(value = "/del", method = RequestMethod.POST)
    public R del(@RequestBody Map<String, Object> params) {
        dateServeice.del(params);
        return R.ok();
    }

    /**
     * 获取redis存入的日期列表
     * @param params
     * @return
     */
//    @RequiresPermissions("op:date:get")
//    @RequestMapping(value = "/get", method = RequestMethod.GET)
//    public R get(@RequestParam Map<String, Object> params) {
//        Long storeId = (Long) params.get("storeId");
//        String restlt = dateServeice.get(storeId);
//        return R.ok().put("result", restlt);
//    }
}
